import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;


public class DonationBoxTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void boxIsMadeCorrectly() {
		DonationBox sally = new DonationBox("Salvation Army");
		
		String name = sally.getCharityName();
		int moneyInBox = sally.getHowMuchMoney();
		
		assertTrue(moneyInBox == 0);
		assertTrue(name.equals("Salvation Army"));
	}
	
	@Test
	public void firstDonation() {
		DonationBox sally = new DonationBox("Salvation Army");
		
		sally.donate(100);
		
		int moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100);		
	}
	
	@Test
	public void secondDonationAdds() {
		DonationBox sally = new DonationBox("Salvation Army");
		
		sally.donate(100);
		int moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100);		

		sally.donate(200);
		moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100 + 200);		

		sally.donate(300);	
		moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100 + 200 + 300);		
	}
	
	@Test
	public void noNegativeDonation() {
		DonationBox sally = new DonationBox("Salvation Army");
		
		sally.donate(100);
		sally.donate(-50);
		
		int moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100);		
	}
	
	@Test
	public void notTooMuchDonation() {
		DonationBox sally = new DonationBox("Salvation Army");
		
		sally.donate(100);
		sally.donate(99999);
		
		int moneyInBox = sally.getHowMuchMoney();		
		assertTrue(moneyInBox == 100);		
	}

}
